package com.zbf.tspring.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author: LCG
 * 作者: LCG
 * 日期: 2021/3/23  14:55
 * 描述:
 */
@Configuration
public class ThreadPoolConfig {

    @Bean("threadPoolExecutor")
    public ThreadPoolExecutor getThreadPoolExecutor(){

        LinkedBlockingDeque linkedBlockingDeque=new LinkedBlockingDeque();

        ThreadPoolExecutor threadPoolExecutor=new ThreadPoolExecutor(4,4,100,TimeUnit.SECONDS,linkedBlockingDeque);

        return threadPoolExecutor;
    }


}
